/************************************
BigInt
BigInt.h - Header file
Calculator for large integers.
CS 133 - Parallel Programming
Professor: Adam Kaplan
Due: 6/3/2011
Collaborators:
Ben Harounian
Justin Kiang
Akhil Rangaraj
************************************/
#ifndef BigInt_H
#define BigInt_H

#include <algorithm>
#include <bitset>
#include <fstream>
#include <iostream>
#include <istream>
#include <omp.h>
#include <string>
#include <sstream>
#include <queue>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

// Number of integers in each BigData string
#define DATA_SIZE 5

// Beginning of the string
#define BEGINNING 0

// Number of bits in bitset
#define NUM_BITS 32

// BigInt Class
class BigInt {
	
	public:
		// Constructors
		BigInt();
		BigInt(const std::string &str);
		BigInt(const std::string &str, const int threads);
		BigInt(const BigInt &another);
		BigInt(const int val);

		// Destructor
    
		// Operators
    
		// Arithmetic Operations (don't need to do Subtraction or Division)
		const BigInt operator+ (const BigInt &right) const;
		const BigInt operator* (const BigInt &right) const;
    
		// Bitwise Operations
		const BigInt operator| (const BigInt &right) const;
		const BigInt operator^ (const BigInt &right) const;
		const BigInt operator& (const BigInt &right) const;
		BigInt operator! ();
    
		// ignment Operations
		BigInt& operator= (BigInt right);

		// Compound ignment Operations
		BigInt& operator+= (const BigInt &right);
		BigInt& operator*= (const BigInt &right);
		BigInt& operator|= (const BigInt &right);
		BigInt& operator^= (const BigInt &right);
		BigInt& operator&= (const BigInt &right);

		// Comparison Operations
		bool operator== (BigInt &right) const;

		// Helpers
		std::string toString();
    
	private:
		void __addHelper(std::bitset<16> a, std::bitset<16> b, std::bitset<16> *c, bool *d);
		std::string divideBy2(std::string a, std::string& b);
		std::string BinToStr(std::vector<int> a, std::string b);
		int numThreads;
		std::vector<std::string> decimalContainer;
		std::vector<int> binaryContainer;
}; // End class definition
#endif
